package com.yunji.base.dao.impl;

import com.yunji.base.dao.IShortCutDao;
import com.yunji.base.domain.ShortCutMenuDO;
import com.yunji.base.mapper.IShortCutMapper;
import com.yunji.base.vo.ShortCutVO;
import com.yunji.common.base.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author : peter-zhu
 * @date : 2024/12/12 11:18
 * @description : TODO
 **/
@Repository
public class ShortCutDaoImpl extends BaseDaoImpl<IShortCutMapper, ShortCutMenuDO> implements IShortCutDao {

    @Override
    public List<ShortCutVO> listByUserId(Long userId, Integer status) {
        return this.baseMapper.listByUserId(userId, status);
    }

    @Override
    public boolean updateByMenuIdAndUserId(Long menuId, Long userId) {
        return lambdaUpdate().set(ShortCutMenuDO::getStatus, 1).
                eq(ShortCutMenuDO::getUserId, userId).eq(ShortCutMenuDO::getMenuId, menuId).update();
    }
}
